package com.code.cheney.action;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.code.cheney.po.UserInfo;
import com.code.cheney.service.IUserService;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

/**   
 *    
 * Project: ssh_Maven   
 * Class: UserAction   
 * Description: 
 * @author: Cheney   
 * @Date 2016年4月9日 下午10:49:07
 * @version 1.0
 *    
 */
public class UserAction extends ActionSupport implements ModelDriven<UserInfo> {
	
	private Integer id;
	private UserInfo userInfo;
	private List<UserInfo> userInfos;
	
	@Autowired
	private IUserService userService;

	@Override
	public String execute() throws Exception {
		userService.service(userInfo);
		return SUCCESS;
	}

	@Override
	public UserInfo getModel() {
		if (null != id) {
			userInfo = userService.get(id);
		} else {
			userInfo = new UserInfo();
		}
		return userInfo;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public UserInfo getUserInfo() {
		return userInfo;
	}

	public void setUserInfo(UserInfo userInfo) {
		this.userInfo = userInfo;
	}

	public List<UserInfo> getUserInfos() {
		return userInfos;
	}

	public void setUserInfos(List<UserInfo> userInfos) {
		this.userInfos = userInfos;
	}
	
	
}
